home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir42 / aaco25.zip / AACOLOR.DOC < prev    next >
Text File  |  1993-07-03  |  43KB  |  945 lines

  1.  
  2.  
  3.  
  4.           
  5.           
  6.           ╔═════════════════╗
  7.           ║  a a C o l o r  ║
  8.           ╚═════════════════╝
  9.           
  10.           ...Alan Anderson's Color Set Editor for Foxpro 2.5
  11.           
  12.           
  13.           
  14.           U S E R ' S   M A N U A L
  15.           =========================
  16.           3nd Edition - March, 1993
  17.           
  18.           
  19.           Copyright (c) 1991-1993 Chamber Data Systems, Inc.
  20.           All Rights Reserved.
  21.           
  22.           FoxPro is a registered trademark of Microsoft Corporation
  23.           
  24.           
  25.           
  26.                           Chamber Data Systems, Inc.
  27.                           15221 Berry Trail, Suite 510
  28.                           Dallas, Texas  75248
  29.           
  30.                   Voice:  (214) 233-1299
  31.                     FAX:  (214) 233-8508
  32.           CompuServe ID:  76566,2666
  33.           
  34.           
  35.           
  36.           TABLE OF CONTENTS
  37.           -----------------
  38.           
  39.           The FoxPro Color Set System                                     1
  40.               Introduction                                                1
  41.               Screen Objects                                              1
  42.               Color Pair Codes                                            3
  43.               Color Sets                                                  4
  44.               Color Schemes                                               6
  45.               Putting It All Together                                     8
  46.               A Few Complications                                         9
  47.               Coding Examples                                            11
  48.           Using aaColor                                                  13
  49.               Installation                                               13
  50.               Selection Techniques                                       13
  51.           Appendix:  Mouse Pointer Color                                 14
  52.  
  53.  
  54.  
  55.  
  56.  
  57.           
  58.           
  59.           
  60.  
  61.  
  62.  
  63.           
  64.           
  65.           
  66.           THE FOXPRO COLOR SET SYSTEM
  67.           ===========================
  68.           
  69.           
  70.           INTRODUCTION
  71.           ------------
  72.           
  73.           FoxPro has an extremely powerful and flexible system for
  74.           controlling the color of screen objects which is based on a
  75.           concept called color sets.  However, FoxPro's implementation of
  76.           color sets seems incomplete; the facilities for managing and
  77.           editing color sets are meager and, in many respects, confusing.
  78.           
  79.           Fortunately, the foundation of the concept of color sets is
  80.           solid, and FoxPro provides the tools to develop better attendant
  81.           facilities.  aaColor is such a facility--a simple yet robust tool
  82.           for understanding, managing, and editing color sets.
  83.           
  84.           
  85.           SCREEN OBJECTS
  86.           --------------
  87.           
  88.           An awareness of the various screen objects supported in FoxPro
  89.           and their colorable elements is key to understanding FoxPro's
  90.           system of controlling colors.  FoxPro supports the following
  91.           types of screen objects.
  92.           
  93.                Menu System
  94.                Windows:
  95.                  System
  96.                  Dialogs
  97.                  Alerts
  98.                  User
  99.                Browse
  100.                Report Layout
  101.           
  102.           A screen object is built from or contains lower level elements.
  103.           For example, the elements of a Menu System are the selection pads
  104.           on its menu bar and each pad's associated popup consisting of
  105.           selection bars inside a border.  The elements of a Dialog Window
  106.           are its title, border, text, fields, popups, lists, push buttons,
  107.           check boxes, etc.  Some window elements are input/output items
  108.           created with "@... GET" commands such as fields and check boxes;
  109.           other elements are items inherent to the window definition such
  110.           as the window title, border, and shadow.
  111.           
  112.           FoxPro's system for controlling colors allows you to
  113.           independently specify the color of the various elements that
  114.           comprise a screen object.  The discussions that follow refer to
  115.           them as a screen object's "colorable elements."
  116.           
  117.           
  118.                                      - Page 1 -                            
  119.  
  120.  
  121.  
  122.           
  123.           Considering the several screen objects that FoxPro supports and
  124.           the numerous colorable elements that can make up each type of
  125.           screen object, FoxPro's system for controlling colors calls for
  126.           flexibility.  Indeed, it is flexible, and its flexibility makes
  127.           it somewhat complicated.  But once understood, and with the help
  128.           of aaColor, it is fairly simple to use.
  129.           
  130.           A side issue here is that of windows.  Observe in the preceding
  131.           list of screen objects that windows are subdivided into four
  132.           classes:  system windows, dialog windows, alert windows, and user
  133.           windows.  These various classes of windows are the same so far as
  134.           the FoxPro facilities that you use to create and control them.
  135.           (Except for system windows that are automatically created for
  136.           you, you use the DEFINE WINDOW command to create windows and
  137.           "@...SAY/GET" commands to create objects within them.)  Windows
  138.           in the various classes differ only in their intended use as their
  139.           names imply and as summarized below.
  140.           
  141.           SYSTEM WINDOWS:  The FoxPro development environment uses system
  142.           windows for nearly everything except dialogs and alerts.  It uses
  143.           system windows for file editing, on-line help, and all of the
  144.           desk accessories (calculator, calendar, etc.).  System windows
  145.           are distinguished by their color and the fact that their borders
  146.           are blank except for window control icons (the icons for closing,
  147.           zooming, sizing, etc.).  An application program would use system
  148.           windows for any similar functions implemented in the application
  149.           such as on-line help and desk accessories.
  150.           
  151.           DIALOGS:  A dialog is a window used to allow a user to specify
  152.           further information after initiating a program action in order to
  153.           further direct the program action.  Dialog windows typically
  154.           contain an assortment of elements such as lists, popups, check
  155.           boxes, radio buttons, and other controls and fields pertinent to
  156.           their function as dialogs.
  157.           
  158.           ALERTS:  Alerts are windows that inform a user of some error,
  159.           condition, or important choice to be made.  An alert usually
  160.           requires a response or an acknowledgement from the user before
  161.           processing can proceed.  Alert windows typically contain only
  162.           text and the one or more push buttons required for a user to
  163.           respond to the alert; they do not contain elements extraneous to
  164.           their function such as popups, lists, check boxes, or radio
  165.           buttons.
  166.           
  167.           USER WINDOWS:  The FoxPro documentation makes no mention of the
  168.           intended use of user windows, and although the FoxPro development
  169.           environment uses dialogs and alerts, it does not employ windows
  170.           of this class.  A major use of windows not included in any of the
  171.           other classes of windows is that of database input/output
  172.           screens, so that could be the assigned use of user windows in an
  173.           application program.
  174.           
  175.           
  176.           
  177.                                      - Page 2 -                            
  178.  
  179.  
  180.  
  181.           
  182.           Although the facilities for creating and controlling these
  183.           various classes of windows are the same (a window is a window
  184.           except for how you program it to be used), each class of windows
  185.           is characterized by its intended use which influences the types
  186.           of elements that comprise windows of that class.  Additionally,
  187.           FoxPro uses unique colors--and in some cases, unique border
  188.           styles--for each class of windows in its development environment
  189.           to provide a visual cue as to a window's class--alert, dialog,
  190.           etc.  FoxPro's system for controlling colors allows you to do the
  191.           same in applications that you develop.
  192.           
  193.           
  194.           COLOR PAIR CODES
  195.           ----------------
  196.           
  197.           Color monitors display colors by combining the colors red, green,
  198.           and blue in various combinations.  These three colors can be
  199.           combined in eight possible ways to form eight basic colors which
  200.           you specify in FoxPro with codes as follows:
  201.           
  202.                 Color    Code
  203.                 ───────  ────
  204.                 Black    N       (no color)
  205.                 Blue     B
  206.                 Green    G
  207.                 Cyan     BG      (Blue & Green combined)
  208.                 Red      R
  209.                 Magenta  RB      (Red & Blue combined)
  210.                 Brown    GR      (Green & Red combined)
  211.                 White    W       (Blue, Green, & Red combined)
  212.           
  213.           You specify the foreground and background colors for the
  214.           characters of a colorable screen element--for example, an
  215.           "@... SAY" field--with a color pair, that is, a pair of color
  216.           codes separated by a slash (/).  For example, W/B specifies a
  217.           white foreground on a blue background.  The eight colors can be
  218.           combined two at a time to form 64 different color pairs.
  219.           
  220.           Including a plus sign (+) after the foreground color in a color
  221.           pair denotes that the foreground color is brightened.  For
  222.           example, W+/B specifies a bright white foreground on a blue
  223.           background.  This feature doubles the number of available color
  224.           pairs to 128 by doubling the number of available foreground
  225.           colors.
  226.           
  227.           Note:  The color brown (code GR) when brightened (code GR+)
  228.                  appears as yellow and so is called yellow rather than
  229.                  bright brown.
  230.           
  231.           Including an asterisk (*) in a color pair denotes a blinking
  232.           foreground if SET BLINK is ON or a bright background if SET BLINK
  233.           is OFF.  For example, if SET BLINK is ON, then W/B* specifies a
  234.           
  235.           
  236.                                      - Page 3 -                            
  237.  
  238.  
  239.  
  240.           blinking white foreground on a blue background; if SET BLINK is
  241.           OFF, then W/B* specifies a white foreground on a bright blue
  242.           background.  (It doesn't make any difference where you place the
  243.           asterisk; W/B* yields the same result as W*/B.)  Thus, if SET
  244.           BLINK is OFF, this feature doubles the number of available color
  245.           pairs to 256 by doubling the number of available background
  246.           colors.
  247.           
  248.           (The color picker in aaColor provides a good way to view all
  249.           possible color pairs and allows you to experiment with different
  250.           combinations of BLINK set to ON or OFF with or without an
  251.           asterisk.)
  252.           
  253.           
  254.           COLOR SETS
  255.           ----------
  256.           
  257.           As previously mentioned, FoxPro supports several types of screen
  258.           objects, many of which have numerous colorable elements.  The
  259.           problem of being able to independently control the colors of all
  260.           the various types of screen objects at the level of their
  261.           respective colorable elements obviously calls for a solution
  262.           involving many color pairs.
  263.           
  264.           FoxPro's solution is the use of "color sets."  A color set is
  265.           simply a two-dimensional array of color pairs such that various
  266.           positions in the array are assigned to particular colorable
  267.           elements in the various types of screen objects.  For example,
  268.           the color pair at column 1, row 1 of a color set specifies the
  269.           color of an "@... SAY" field in a User Window; the color pair at
  270.           column 3, row 7 of a color set specifies the color of popup
  271.           option hot keys in the System Menu; and so on.  Hence, the color
  272.           pairs in a color set determine, in a manner predefined by the
  273.           position of each, the colors of each colorable element in each
  274.           type of screen object supported by FoxPro.  The FoxPro
  275.           Developer's Guide has a table that shows color pair assignments
  276.           for color sets.
  277.           
  278.           Note:  A color set is not a memory variable array such as
  279.                  one defined with the DIMENSION command in an
  280.                  application program but rather an array within FoxPro,
  281.                  and the color pairs in a color set are stored as
  282.                  binary values rather than as color pair codes.
  283.                  However, you specify color pairs with color pair codes
  284.                  in any FoxPro functions or commands that require
  285.                  specification of color pairs.
  286.           
  287.           The array that comprises a color set has 24 columns and 11 rows
  288.           for a total of 264 positions.  The 24 positions in the eleventh
  289.           row of a color set have a special purpose related to window
  290.           shadows which is described in the discussion of color schemes in
  291.           the next section.  Each of the other 240 positions in a color set
  292.           contain a color pair.
  293.           
  294.           
  295.                                      - Page 4 -                            
  296.  
  297.  
  298.  
  299.           
  300.           Color Set:
  301.           
  302.                       1    2    3    4    5    6      . . .     23   24
  303.                     ┌────┬────┬────┬────┬────┬────┬─         ─┬────┬────┐
  304.                  1  │ cp │ cp │ cp │ cp │ cp │ cp │   . . .   │ cp │ cp │
  305.                     ├────┼────┼────┼────┼────┼────┼─         ─┼────┼────┤
  306.                  2  │ cp │ cp │ cp │ cp │ cp │ cp │   . . .   │ cp │ cp │
  307.                     ├────┼────┼────┼────┼────┼────┼─         ─┼────┼────┤
  308.                  3  │ cp │ cp │ cp │ cp │ cp │ cp │   . . .   │ cp │ cp │
  309.                     ├────┼────┼────┼────┼────┼────┼─         ─┼────┼────┤
  310.                  .    .    .    .    .    .    .      .         .    .
  311.                  .    .    .    .    .    .    .        .       .    .
  312.                  .    .    .    .    .    .    .          .     .    .
  313.           
  314.                     ├────┼────┼────┼────┼────┼────┼─         ─┼────┼────┤
  315.                 10  │ cp │ cp │ cp │ cp │ cp │ cp │   . . .   │ cp │ cp │
  316.                     ├────┼────┼────┼────┼────┼────┼─         ─┼────┼────┤
  317.                 11  │ si │ si │ si │ si │ si │ si │   . . .   │ si │ si │
  318.                     └────┴────┴────┴────┴────┴────┴─         ─┴────┴────┘
  319.           
  320.                     Legend:  cp = color pair
  321.                              si = shadow indicator
  322.           
  323.           
  324.           Most of the positions in the first half of a color set
  325.           array--those in columns 1 through 12--are assigned to colorable
  326.           elements of screen objects.  The FoxPro Developer's Guide refers
  327.           to columns 13 through 16 as "reserved for future use" (presumably
  328.           for new types of screen objects that may be introduced in a
  329.           future version of FoxPro).  It refers to columns 17 through 24 as
  330.           "user schemes" which presumably means that they are available to
  331.           a developer to define as desired--possibly to assign colors to
  332.           additional classes of windows or other screen objects that a
  333.           developer may invent in addition to those already defined in
  334.           FoxPro.
  335.           
  336.           In any case, a color set contains many color pairs.  And,
  337.           considering that each color pair can have any of 256 different
  338.           values, the number of ways that a color set can be created to
  339.           specify colors for the various screen objects and their colorable
  340.           elements is practically without limit.  Thus, FoxPro's color set
  341.           system allows an enormous amount of variety in specifying color.
  342.           
  343.           Color sets are stored in a resource file and assigned unique
  344.           names so that they can be individually referenced by facilities
  345.           that load and store color sets from or to a resource file.  The
  346.           default resource file shipped with FoxPro, FOXUSER.DBF/FPT,
  347.           includes several color sets.
  348.           
  349.  
  350.  
  351.  
  352.           
  353.           
  354.                                      - Page 5 -                            
  355.  
  356.  
  357.  
  358.           FoxPro provides two commands and one interactive facility for
  359.           managing and editing color sets.  The two commands are
  360.           
  361.                SET COLOR SET TO <color set name>
  362.           
  363.           and
  364.           
  365.                CREATE COLOR SET <color set name>.
  366.           
  367.           SET COLOR SET TO <color set name> loads and activates a specified
  368.           color set from the resource file.  By maintaining different color
  369.           sets in a resource file, you can instantly change the entire
  370.           coloring of the FoxPro development environment or a FoxPro
  371.           application program by simply activating a different color set.
  372.           
  373.           CREATE COLOR SET <color set name> stores the currently active
  374.           color set to the resource file and names it as specified.  If a
  375.           color set already exists in the resource file with the same name,
  376.           it is overwritten.
  377.           
  378.           You can also load and store color sets from and to a resource
  379.           file with FoxPro's color picker, an interactive facility accessed
  380.           from the System Menu (see Window pad, popup option Color...).
  381.           The color picker is FoxPro's only interactive facility for
  382.           editing a color set, that is, for modifying the values of color
  383.           pairs in a color set.  As such, FoxPro's color picker is an
  384.           important component in its color set system.  Yet curiously, it
  385.           is the component that is most lacking in function and clarity.
  386.           Its deficiencies are the cause of much criticism of the entire
  387.           color set system and the reason that aaColor was developed.
  388.           
  389.           
  390.           COLOR SCHEMES
  391.           -------------
  392.           
  393.           The previous section describes a color set as an array of color
  394.           pairs where each position in the array specifies the color of
  395.           some particular colorable screen element in a predefined way.
  396.           The FoxPro documentation describes a color set as a collection of
  397.           "color schemes" and defines a color scheme as a list of ten color
  398.           pairs.
  399.           
  400.           You can see by inspecting the table of color pair assignments for
  401.           color sets in the FoxPro Developer's Guide that a color scheme is
  402.           simply a column in the array of color pairs comprising a color
  403.           set.  This table also shows that the assignments are such that a
  404.           color scheme--a column in the color set array--corresponds to the
  405.           various colorable elements of a screen object of some kind--for
  406.           example, a menu or a dialog window.
  407.           
  408.           The table of color pair assignments shows only ten rows.
  409.           However, a color set array has an additional eleventh row not
  410.           shown in the table that, as previously mentioned, has a special
  411.           
  412.           
  413.                                      - Page 6 -                            
  414.  
  415.  
  416.  
  417.           purpose related to shadows.  The eleventh row of a color
  418.           set--that is, the eleventh position of each of its color
  419.           schemes--contains a plus or minus sign (+ or -) to indicate
  420.           whether or not the screen object to which a color scheme
  421.           corresponds casts a shadow.  So a color scheme is actually a list
  422.           of ten color pairs followed by a plus or minus sign (+ or -).
  423.           
  424.           Example:  Color Scheme 1 - User Windows
  425.           
  426.           Position    Code          Element Colored
  427.           ────────    ───────       ───────────────────────────────────
  428.              1        W+/B          Normal Text
  429.              2        W+/BG         Field, Enabled
  430.              3        GR+/B         Border
  431.              4        GR+/B         Title, Active
  432.              5        W/B           Title, Idle / System Message Line
  433.              6        W+/RB         Text/Control, Selected
  434.              7        GR+/B         Push Button Hot Keys / System Clock
  435.              8        N+/N          Shadow
  436.              9        W+/B          Control, Enabled
  437.             10        W/B           Field/Control, Disabled
  438.             11        +             Casts Shadow
  439.           
  440.           This example lists the color pairs vertically to be consistent
  441.           with the fact that a color scheme is a column in a color set
  442.           array.  However, the FoxPro documentation list them horizontally
  443.           and separated by commas.
  444.           
  445.           Example:  W+/B,W+/BG,GR+/B,GR+/B,W/B,W+/RB,GR+/B,N+/N,W+/B,W/B,+
  446.           
  447.           The horizontal, comma-delimited format is the required syntax for
  448.           specifying a color pair list in commands that allow one to be
  449.           specified.
  450.           
  451.           A color scheme is identified by its column number in the color
  452.           set array (1, 2, 3, ..., 24).  The FoxPro documentation also
  453.           includes descriptive names of color schemes such as Menu Bar,
  454.           Menu Pops, Dialogs, Dialog Pops, etc.  However, any references to
  455.           a color scheme in a FoxPro command or function is by its number;
  456.           descriptive names appear only in the FoxPro documentation and
  457.           certain popups in dialogs for selecting color schemes.
  458.           
  459.           Commands that create a screen object such as DEFINE WINDOW and
  460.           DEFINE MENU support the clause
  461.           
  462.                COLOR SCHEME <scheme number>
  463.           
  464.           so that a specified color scheme can be associated with the
  465.           screen object being created.  With certain exceptions discussed
  466.           later, a screen object so defined requires no further color
  467.           specifications for its colorable elements; the specified color
  468.           scheme controls the color of all the object's colorable elements.
  469.           For example, if you include the clause COLOR SCHEME <scheme
  470.           
  471.           
  472.                                      - Page 7 -                            
  473.  
  474.  
  475.  
  476.           number> in a DEFINE WINDOW command, the specified color scheme
  477.           controls all of the window's colorable elements--its border,
  478.           title, etc., and also elements subsequently created with
  479.           "@... SAY/GET" commands.
  480.           
  481.           Note:  The clause COLOR SCHEME <scheme number> can also be
  482.                  specified in "@... SAY/GET" commands.  However, control
  483.                  at that level is only necessary if you want "@... SAY/GET"
  484.                  items to have colors different than those specified by
  485.                  the window's controlling color scheme.
  486.           
  487.           In addition to the clause COLOR SCHEME <scheme number> that is
  488.           available in the numerous commands that create various types of
  489.           screen objects, FoxPro provides the following command and
  490.           function that deal directly with color schemes.
  491.           
  492.               SET COLOR OF SCHEME <scheme number> TO <color pair list>|
  493.                                                      <scheme number>
  494.           
  495.               SCHEME(<scheme number>[, <pair number>])
  496.           
  497.           The command SET COLOR OF SCHEME... sets the color pairs and
  498.           shadow indicator of the specified scheme to the specified values.
  499.           aaColor utilizes this command in the editing of color sets.
  500.           However, it seems unlikely that an application program other than
  501.           a color set editor like aaColor would have a need to use this
  502.           command if the application program makes proper use of color
  503.           sets.
  504.           
  505.           The function SCHEME(...) returns the color pair list and shadow
  506.           indicator (or optionally, only the specified color pair) from the
  507.           specified color scheme.
  508.           
  509.           
  510.           PUTTING IT ALL TOGETHER
  511.           -----------------------
  512.           
  513.           The system of controlling color in FoxPro consists of
  514.           
  515.           1) maintaining color sets, each of which is a collection of color
  516.           schemes, each of which is a list of color pairs that control the
  517.           colors of colorable elements of the type of screen object to
  518.           which the color scheme is assigned;
  519.           
  520.           2) loading the desired color set from the resource file (if using
  521.           a color set other than the default color set); and
  522.           
  523.           3) using the clause COLOR SCHEME <scheme number> in commands that
  524.           create screen objects in order to link each screen object to its
  525.           appropriate color scheme, that is, the column of color pairs in
  526.           the color set that controls the colors of the screen object's
  527.           colorable elements.
  528.           
  529.           
  530.           
  531.                                      - Page 8 -                            
  532.  
  533.  
  534.  
  535.           Although FoxPro's color set system may seem complicated, it is
  536.           extremely flexible and has the advantage of centralized and
  537.           automated control.  It's flexible in that you can create and
  538.           maintain many different color sets in the resource file.  It's
  539.           centralized in that the specification of all current color
  540.           settings are stored in a single repository--the currently active
  541.           color set.  And it's automatic in that the colors of all the
  542.           various colorable elements of screen objects that you create are
  543.           automatically determined by linking the object to the currently
  544.           active color set using the clause COLOR SCHEME <scheme number> in
  545.           the commands that create the objects.  Furthermore, you can
  546.           instantly change the entire coloring of the FoxPro development
  547.           environment or a FoxPro application program by simply activating
  548.           a different color set from the resource file.
  549.           
  550.           Compare this to FoxBASE+, FoxPro's predecessor.  Control of color
  551.           in FoxBASE+ was limited to the command
  552.           
  553.                SET COLOR TO [<standard>[, <enhanced>[, <border>]]]
  554.           
  555.           which you had to invoke each time you wanted to change colors and
  556.           which, if you wanted to achieve any variety in the use of colors,
  557.           had to be sprinkled throughout a program.  FoxPro's color set
  558.           system is a giant step forward.
  559.           
  560.           
  561.           A FEW COMPLICATIONS
  562.           -------------------
  563.           
  564.           This section describes an aspect of FoxPro's color set system
  565.           that somewhat clutters its otherwise elegant solution for
  566.           controlling color and explains how aaColor solves this problem.
  567.           The complication (as described below) is that 1) in some cases
  568.           two color schemes jointly control the colors of a single screen
  569.           object, and 2) in some cases a single color pair jointly controls
  570.           the color of more than one type of element in a screen object.
  571.           (An example of the latter is that the same color pair controls
  572.           the color of the system clock and a push button hot key in a User
  573.           Window.)
  574.           
  575.           The prior description of color schemes was oversimplified for the
  576.           sake of explanation when it stated that color schemes--that is,
  577.           columns in a color set array--are assigned to control the colors
  578.           of the various types of screen objects.  Actually, some screen
  579.           objects require two color schemes to control their colors.
  580.           
  581.           Consider the various classes of windows (dialogs, alerts, etc.).
  582.           Let's call the elements in a window that are created with
  583.           "@... SAY/GET" commands subobjects of the window--fields, push
  584.           buttons, radio buttons, check boxes, popups, lists, etc.  The
  585.           number of colorable elements that can comprise a window and all
  586.           of its possible subobjects is sixteen, six more than the ten
  587.           color pairs in a color scheme.  Therefore, a single color scheme
  588.           
  589.           
  590.                                      - Page 9 -                            
  591.  
  592.  
  593.  
  594.           is not sufficient for controlling the sixteen colorable elements
  595.           of a window.  Two types of window subobjects--namely, popups and
  596.           lists--account for the number of colorable elements in excess of
  597.           ten.
  598.           
  599.           Popups and lists are considered subobjects of a window when they
  600.           are created in the window, but you could consider them to be
  601.           screen objects in their own right if not created in a window but
  602.           rather created in the screen.  (Recent trends in the design of
  603.           window-oriented user interfaces suggest that you should create
  604.           popups and lists in windows and therefore consider them to be
  605.           subobjects of windows.)  In any case, popups and lists have six
  606.           colorable elements each and are similar in structure.  So popups
  607.           and lists are jointly assigned their own color schemes to control
  608.           their colors.
  609.           
  610.           Thus, a window requires two color schemes to control its
  611.           colors--the primary color scheme that controls the colors of
  612.           colorable elements except for popups and lists, and an additional
  613.           color scheme that controls the colors of popups and/or lists to
  614.           which it is host.
  615.           
  616.           The following table shows the color schemes used to control the
  617.           various classes of windows and their respective popups and lists.
  618.           
  619.               Window Classes   Color Schemes  (Primary & Popup/List)
  620.               ──────────────   ─────────────────────────────────────
  621.               System Windows   8 & 9
  622.               Dialogs          5 & 6
  623.               Alerts           7 & 12
  624.               User Windows     1 & 2
  625.           
  626.           Note:  The FoxPro documentation describes COLOR SCHEME 2 as
  627.                  controlling the color of "User Menus."  This appears
  628.                  to be a misnomer in that 1) it implies that there is a
  629.                  screen object called a User Menu that requires its own
  630.                  color scheme when in fact there does not seem to be
  631.                  such a screen object or the requirement for one; and
  632.                  2) COLOR SCHEME 2, in fact, controls the colors of
  633.                  popups and lists in user windows.  Since the color
  634.                  schemes that control the colors of popups and lists in
  635.                  system windows, dialogs, and alerts are called "System
  636.                  Window Pops", "Dialog Pops", and "Alert Pops",
  637.                  respectively, then Color Scheme 2 should more properly
  638.                  be called "User Window Pops."  Hence, aaColor refers
  639.                  to COLOR SCHEME 2 as "User Window Pops" rather than
  640.                  "User Menus."
  641.           
  642.           Now consider menu systems.  Although a menu system has only ten
  643.           colorable elements, two color schemes are assigned to control the
  644.           colors in a menu system.  COLOR SCHEME 3 controls the colors of
  645.           the four colorable elements in a menu bar, and COLOR SCHEME 4
  646.           controls the colors of the six colorable elements in a menu
  647.           
  648.           
  649.                                      - Page 10 -                           
  650.  
  651.  
  652.  
  653.           popup.
  654.           
  655.           The FoxPro documentation explains color sets in terms of color
  656.           schemes, and the FoxPro interactive color picker is also oriented
  657.           to color schemes.  Since color schemes do not correspond to
  658.           screen objects in a one-to-one manner, and since the assignment
  659.           of color schemes to screen objects is somewhat arbitrary, this
  660.           orientation muddles the relationship between screen objects and
  661.           the color set system.  A simpler and clearer approach is to
  662.           orient the discussion of the color set system to screen objects
  663.           as done in this document.  That is, start with the idea of screen
  664.           objects and relate them to their respective color schemes in a
  665.           color set.  After all, the whole purpose of the color set system
  666.           is to control the colors of screen objects.
  667.           
  668.           Therefore, the facilities for viewing and editing color sets in
  669.           aaColor are oriented to screen objects rather than color schemes.
  670.           This approach clarifies much of the complexity of the color set
  671.           system.  In aaColor, you first select the screen object whose
  672.           colors you want to view or edit.  You can then select from among
  673.           its colorable elements and pick colors from aaColor's color
  674.           picker with instant feedback--that is, aaColor immediately
  675.           displays the results in the sample screen object as you make
  676.           color selections.  aaColor automatically relates screen objects
  677.           and their colorable elements to their controlling color schemes
  678.           and color pairs in the color set so that you need not be aware of
  679.           the complex system of assignments.
  680.           
  681.           
  682.           CODING EXAMPLES
  683.           ---------------
  684.           
  685.           Example 1:  Using the Alert Color Scheme for a WAIT WINDOW
  686.           
  687.           PROCEDURE AlertWait
  688.           PARAMETER AlertMsg
  689.           PRIVATE SaveSchm5
  690.           m.SaveSchm5 = SCHEME(5)                 &&  save Dialog colors
  691.           SET COLOR OF SCHEME 5 TO SCHEME 7       &&  change Dialog colors
  692.                                                   &&    to Alert colors
  693.           ??CHR(7)  && ring bell
  694.           WAIT WINDOW m.AlertMsg + "; press any key to continue..."
  695.           SET COLOR OF SCHEME 5 TO (m.SaveSchm5)  &&  restore Dialog colors RETURN
  696.           
  697.           
  698.           Example 2:  Customizing the Color of Help Windows
  699.           
  700.           The FoxPro Developer's Guide explains how you implement context-
  701.           sensitive help for applications that you develop.  The color of
  702.           help windows are controlled by COLOR SCHEMES 8 & 9, the color
  703.           schemes that control System Windows.  The following illustrates a
  704.           technique whereby you can implement help windows in an
  705.           application with colors different than System Windows without
  706.           
  707.           
  708.                                      - Page 11 -                           
  709.  
  710.  
  711.  
  712.           changing the color of other types of System Windows like the
  713.           Calculator, Calendar, etc.
  714.           
  715.           First, use aaColor to set the colors in two of the "user-defined"
  716.           color schemes to the desired colors for help windows.  The
  717.           example below uses COLOR SCHEMES 17 & 18.
  718.           
  719.           At the beginning of the application program, code the following
  720.           statements to set up the context-sensitive help:
  721.           
  722.           SET HELP TO <filename>
  723.           ON KEY LABEL F1 DO MyHelp  && establish help hot key
  724.           
  725.             .
  726.             .
  727.             .
  728.           
  729.           PROCEDURE MyHelp
  730.           PRIVATE SaveSchm8, SaveSchm9
  731.           m.SaveSchm8 = SCHEME(8)   && save System Window & Popup colors
  732.           m.SaveSchm9 = SCHEME(9)   &&
  733.           SET COLOR OF SCHEME 8 TO SCHEME 17  && change System Window & Popup colors
  734.           SET COLOR OF SCHEME 9 TO SCHEME 18  &&   to Help Window & Popups colors
  735.           HELP
  736.           SET COLOR OF SCHEME 8 TO (m.SaveSchm8)  && restore System Window
  737.           SET COLOR OF SCHEME 9 TO (m.SaveSchm9)  &&   & Popup colors
  738.           RETURN
  739.           
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.           
  766.           
  767.                                      - Page 12 -                           
  768.  
  769.  
  770.  
  771.           
  772.           USING aaCOLOR
  773.           =============
  774.           
  775.           
  776.           INSTALLATION
  777.           ------------
  778.           
  779.           aaColor is implemented specifically for FoxPro 2.5; it will not
  780.           work with prior versions.
  781.           
  782.           aaColor consists of one file as follows:
  783.           
  784.                AACOLOR.APP
  785.           
  786.           For convenient access to aaColor, install aaColor in a
  787.           subdirectory included in FoxPro's path.
  788.           
  789.           Once installed, run aaColor by entering
  790.           
  791.                     DO AACOLOR
  792.           
  793.           in the FoxPro Command Window.
  794.           
  795.           SELECTION TECHNIQUES
  796.           --------------------
  797.           
  798.           aaColor displays dialog boxes in various situations whereby you
  799.           select an item from a list after which you press or click a push
  800.           button to continue with processing.  With such dialogs boxes, a
  801.           shortcut for selecting a list item and choosing the default push
  802.           button is to double-click on the list item.
  803.           
  804.           This shortcut technique also works in the color-picker and
  805.           character-picker dialogs.  For example, when using the color-
  806.           picker dialog, you can select a color in the palette by clicking
  807.           on it and then click on the "<< OK >>" button to close the
  808.           dialog.  Or using the shortcut method, you can simply double-
  809.           click on the color in the palette to select it and close the
  810.           dialog.
  811.           
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.           
  825.           
  826.                                      - Page 13 -                           
  827.  
  828.  
  829.  
  830.           
  831.           Appendix:  MOUSE POINTER COLOR
  832.           ================================
  833.           
  834.           The mouse pointer in FoxPro is a screen character that has the
  835.           same character value as the screen character to which it points
  836.           but having a contrasting color.  Thus, as you move the mouse
  837.           pointer around, its position is apparent because of its
  838.           contrasting color.  To understand how FoxPro derives the
  839.           contrasting color of the mouse pointer, first consider how colors
  840.           are specified in FoxPro.
  841.           
  842.           Color monitors display colors by combining the colors red, green,
  843.           and blue in various combinations.  These three colors can be
  844.           combined in eight possible ways to form eight basic colors which
  845.           you specify in FoxPro with codes as follows:
  846.           
  847.           
  848.                Color    Code
  849.                -------  ----
  850.                Black    N       (no color)
  851.                Blue     B
  852.                Green    G
  853.                Cyan     BG      (Blue & Green combined)
  854.                Red      R
  855.                Magenta  RB      (Red & Blue combined)
  856.                Brown    GR      (Green & Red combined)
  857.                White    W       (Blue, Green, & Red combined)
  858.           
  859.           
  860.           You specify the foreground and background colors for the
  861.           characters of a colorable screen element with a color pair, that
  862.           is, a pair of color codes separated by a slash (/).  For example,
  863.           W/B specifies a white foreground on a blue background.
  864.           
  865.           The FoxPro color codes are based on IBM PC CGA/EGA/VGA text mode
  866.           video in which each display character has an attribute byte,
  867.           various bits of which specify its foreground and background
  868.           colors.  Without getting into a detailed discussion of the
  869.           CGA/EGA/VGA video attribute byte, it suffices to say that three
  870.           bits--corresponding to red, green, and blue--specify the
  871.           foregorund color, and another three bits specify the background
  872.           color as follows.
  873.           
  874.           
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.           
  884.           
  885.                                      - Page 14 -                           
  886.  
  887.  
  888.  
  889.                Color Bits
  890.                -------------    decimal
  891.                 R    G    B     value      Color    Code
  892.                ---  ---  ---    -------    -------  ----
  893.                 0    0    0       0        Black    N
  894.                 0    0    1       1        Blue     B
  895.                 0    1    0       2        Green    G
  896.                 0    1    1       3        Cyan     BG
  897.                 1    0    0       4        Red      R
  898.                 1    0    1       5        Magenta  RB
  899.                 1    1    0       6        Brown    GR
  900.                 1    1    1       7        White    W
  901.           
  902.           
  903.           The "inverse" of a color is the color derived by inverting the
  904.           value of each of the "RGB" color bits.  For example, the "RGB"
  905.           bits for Blue (color code B) are "001"; inverting these bits
  906.           yeilds "110", the code for Brown (color code GR).  Hence, the
  907.           inverse of blue is brown.  The following table shows the inverse
  908.           of each color similarly derived.
  909.           
  910.           
  911.                Normal                 Inversed
  912.                -------------          -------------
  913.                Color    Code          Color    Code
  914.                -------  ----          -------  ----
  915.                Black    N             White    W
  916.                Blue     B             Brown    GR
  917.                Green    G             Magenta  RB
  918.                Cyan     BG            Red      R
  919.                Red      R             Cyan     BG
  920.                Magenta  RB            Green    G
  921.                Brown    GR            Blue     B
  922.                White    W             Black    N
  923.           
  924.           
  925.           FoxPro derives the contrasting color pair for a character to
  926.           which the mouse points by inverting both its foreground color and
  927.           background color.  For example, if the color of a character is
  928.           W/B (White/Blue), then its color will be N/GR (Black/Brown) when
  929.           the mouse points to it.
  930.           
  931.           
  932.           
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.           
  943.           
  944.                                      - Page 15 -                           
  945.